#include "../include/netdisk.h"

int tcpConnect(const char* ip, const char* port)
{
    int sockfd = socket(AF_INET,SOCK_STREAM,0);
    if(sockfd < 0)
    {
        perror("client socket failed");
    }    
    struct sockaddr_in addr;
    addr.sin_family = AF_INET;
    addr.sin_port = htons(atoi(port));
    addr.sin_addr.s_addr = inet_addr(ip);

    int ret = connect(sockfd,(struct sockaddr *)&addr,sizeof(addr));
    if (ret == -1)
    {
        sockfd = -1000;
    }
    
    return sockfd;
}